package com.tarena.util.datasource;

import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.ResultSet;

public class SQLPlus {
	public static void main(String[] args){
		
	}
	
	public static void execute(String sql){
		Connection conn = null;
		ResultSet rs = null;
		Statement stmt = null;
		try {
			conn=DBConnection.getConnection();
			stmt=conn.createStatement();
			boolean b = stmt.execute(sql);
			if(b){
				rs=stmt.getResultSet();
				ResultSetMetaData rmd = rs.getMetaData();
				int columnCount = rmd.getColumnCount();

				for (int i = 1; i <= columnCount; i++) {
					String columnName = rmd.getColumnName(i);
					
				}
			}
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
